extends Spatial
var opened_chest=0
func _ready():
	print_debug("coin",Global.score)
	$Score.text="score:"+str(Global.score)
	var control_connect=load("res://script/mobile_control.gd").new()
	control_connect.i_conect(get_node("Control"),$player)
	pass 

func _on_player_died(life):
	$life.text="life:"+str(life)
	pass 


func _on_star_collided():
	$coin.play()
	Global.add_score()
	$Score.text="score:"+str(Global.score)
	pass 


func _on_player_open_chest():
	opened_chest+=1
	$box.play()
	if opened_chest==2:
		$next_level.show()
		$Sprite3D.show()
		$Sprite3D/Area/CollisionShape.disabled=false
		
	print_debug("打开的箱子",str(opened_chest))
	pass # Replace with function body.
